﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	x:Class="View.UserControlTextBoxPseudo"
	x:Name="UserControl" Width="330" Height="40">
	<UserControl.Resources>
		<LinearGradientBrush x:Key="Brush2" EndPoint="0.5,1" StartPoint="0.5,0">
			<GradientStop Color="#FF7597E2" Offset="0"/>
			<GradientStop Color="#FFFFFFFF" Offset="1"/>
		</LinearGradientBrush>
		<Storyboard x:Key="OnClick1">
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="gridNonEditable" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Collapsed}"/>
			</ObjectAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="gridEditableButton" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
			</ObjectAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="OnLostFocus1">
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="gridEditableButton" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Collapsed}"/>
			</ObjectAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="gridNonEditable" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
			</ObjectAnimationUsingKeyFrames>
		</Storyboard>
	</UserControl.Resources>
	<UserControl.Triggers>
		<EventTrigger RoutedEvent="Keyboard.LostKeyboardFocus" SourceName="textBox">
			<BeginStoryboard Storyboard="{StaticResource OnLostFocus1}" x:Name="OnLostFocus1_BeginStoryboard"/>
		</EventTrigger>
		<EventTrigger RoutedEvent="FocusManager.LostFocus" SourceName="textBox">
			<BeginStoryboard Storyboard="{StaticResource OnLostFocus1}" x:Name="OnLostFocus1_BeginStoryboard1"/>
		</EventTrigger>
		<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button1">
			<BeginStoryboard Storyboard="{StaticResource OnLostFocus1}" x:Name="OnLostFocus1_BeginStoryboard2"/>
		</EventTrigger>
		<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button">
			<BeginStoryboard Storyboard="{StaticResource OnClick1}"/>
		</EventTrigger>
	</UserControl.Triggers>

	<Grid x:Name="LayoutRoot" Height="42">
		<Grid Margin="0,0,0,0" x:Name="gridNonEditable" Visibility="Visible">
			<Button Margin="8,8,8,8" Content="{Binding Path=Text, ElementName=textBox, Mode=Default}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalAlignment="Stretch" x:Name="button">
				<Button.Background>
					<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
						<GradientStop Color="#FF7CB0C0" Offset="1"/>
						<GradientStop Color="#FFFFFFFF" Offset="0"/>
					</LinearGradientBrush>
				</Button.Background>
			</Button>
		</Grid>
		<Grid Margin="0,0,0,0" x:Name="gridEditableButton" Visibility="Collapsed">
			<TextBox Margin="8,8,40,8" Text="{Binding Nickname, Mode=TwoWay}" TextWrapping="Wrap" x:Name="textBox" Visibility="Visible"/>
			<Button HorizontalAlignment="Right" Margin="0,8,8,8" Width="30" Content="OK" x:Name="button1"/>
		</Grid>
	</Grid>
</UserControl>